package com.hongxun.design;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.hongxun.design.bean.MyNewBean;
import com.hongxun.design.mytools.MString;
import com.hongxun.design.mytools.MyLog;
import com.hongxun.design.utils.fastjson.FastJsonUtil;
import com.hongxun.design.utils.fileutil.SetFileUtil;

import static com.hongxun.design.MyApp.pushClick;

/**
 * Created by zerdoor_pc .
 * author:dc
 * 2017/1/7.
 */

public class NotificationClickReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {

        String  message=intent.getStringExtra("message");
        String  value=intent.getStringExtra("value");
        String  title=intent.getStringExtra("title");
        MyLog.L(MString.SUCCESSED + "xfsdf msg.custom=" + message);
        //ToastShow.showShort(context, msg.custom);
        MyNewBean b = FastJsonUtil.getMyNewBean(message);
        b.setTitle(title);
        b.setContent(value);
        if (b.getObject_type().equals(MString.code_one) && b.getSchedule() != 0 && b.getSchedule() >= 11 && b.getSchedule() <= 14) {
            //更新项目阶段数据
            String stage_id = b.getObject_id();
            int schedule = b.getSchedule();
            SetFileUtil.updateProjectSchedule(stage_id, schedule);
        }
        pushClick(b);



    }
}
